﻿Imports System.Data.OleDb

Public Class ReceiptsDAO
    Public Function Receipts_Insert(ByVal ExportItemID As Integer, _
                                    ByVal Description As String, _
                                    ByVal Price As Double, _
                                    ByVal PricebyText As String, _
                                    ByVal RateOfExchange As Integer, _
                                    ByVal ReceiptDate As Date, _
                                    ByVal ReceiptBy As Integer, _
                                    ByVal CreatedBy As String) As Boolean
        Dim para(7) As OleDbParameter
        Dim p As New OleDbParameter("@ExportItemID", ExportItemID)
        p.OleDbType = OleDbType.Integer
        para(0) = p

        p = New OleDbParameter("@Description", Description)
        p.OleDbType = OleDbType.VarWChar
        para(1) = p

        p = New OleDbParameter("@Price", Price)
        p.OleDbType = OleDbType.Double
        para(2) = p

        p = New OleDbParameter("@PricebyText", PricebyText)
        p.OleDbType = OleDbType.VarWChar
        para(3) = p

        p = New OleDbParameter("@RateOfExchange", RateOfExchange)
        p.OleDbType = OleDbType.Numeric
        para(4) = p

        p = New OleDbParameter("@ReceiptDate", ReceiptDate)
        p.OleDbType = OleDbType.Date
        para(5) = p

        p = New OleDbParameter("@ReceiptBy", ReceiptBy)
        p.OleDbType = OleDbType.Integer
        para(6) = p

        p = New OleDbParameter("@CreatedBy", CreatedBy)
        p.OleDbType = OleDbType.VarWChar
        para(7) = p

        Return objConnectionDAO.ExecuteStoreprocedureNoneReturn("spTDT_Receipts_Insert", para)
    End Function


    Public Function Receipts_List() As DataSet
        Return objConnectionDAO.ExecuteStoreprocedure("spTDT_Receipts_List", Nothing)
    End Function

    Public Function Receipts_Delete(ByVal ReceiptID As Integer) As Boolean
        Dim para(0) As OleDbParameter
        para(0) = New OleDbParameter("@ReceiptID", ReceiptID)
        para(0).OleDbType = OleDbType.Integer

        Return objConnectionDAO.ExecuteStoreprocedureNoneReturn("spTDT_Receipts_Delete", para)
    End Function
End Class
